<h1>Loading Modules From Views</h1>
<p>Within the Trongate framework, it is possible to load another module from within a view file. This capability provides additional flexibility and allows for dynamic content generation within views.</p>
<p>To load a module from a view file, use the following syntax:</p>
[code=vf]&lt;?= Modules::run("module_name/method_name") ?&gt;[/code]
<h2>Why Use This Approach?</h2>
<p>There are various scenarios where loading a module from within a view file can be advantageous. For instance, consider the need to include a 'Stripe' payment button on a webpage. When users click the 'Buy Now' button, a pop-up might appear, prompting the user to enter payment details. The implementation of such a feature can be complex and is best handled by a dedicated 'stripe' module.</p>
<p>Having a separate 'stripe' module that manages everything related to Stripe payments, including rendering the pop-up payment modal, allows you to maintain clean and organized code. This module can be easily called from any view file with a single line of code, as shown below:</p>
[code=vf]&lt;?= Modules::run("stripe/render_payment_button") ?&gt;[/code]
<h2>Passing Arguments</h2>
<p>When calling modules from view files, arguments can be passed to the methods. This is done by separating the arguments with commas. Below is an example where a variable called <code>$name</code> is passed as an argument:</p>
[code=vf]&lt;?= Modules::run("welcome/greeting", $name) ?&gt;[/code]
